package uqbar.aspectj.observable.mixin;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

import examples.observable.ObservableTestObject;

/**
 * @author uqbar
 */
public class ObservableByMixinExample {
	
	public static void main(String[] args) {
		ObservableTestObject object = new ObservableTestObject();
		
		object.addPropertyChangeListener("name", new PropertyChangeListener(){
			@Override
			public void propertyChange(PropertyChangeEvent evt) {
				String eventDescription = evt.getSource() + "." + evt.getPropertyName() + ": " + evt.getOldValue() + " -> " + evt.getNewValue();
				System.out.println("Changed: " + eventDescription);
			}
		});
		
		object.setName("nuevoNombre");
		object.setName("otroMasNuevo");
		object.setName("unTerceroAunMasNuevo");
	}
	
}
